package com.yonyougov.cruxtestcase.testcase.logincase;


import com.yonyougov.cruxtestcase.basecase.BaseCase;
import com.yonyougov.cruxtestcase.dto.BaseResponseDto;
import com.yonyougov.cruxtestcase.dto.BaseTestReqDto;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
@RequestMapping("/api/logincase")
@Valid
public class LoginCaseController implements BaseCase {
    private final LoginCaseService loginCaseService;

    public LoginCaseController(LoginCaseService loginCaseService) {
        this.loginCaseService = loginCaseService;
    }

    @Override
    public String getName() {
        return "登录测试";
    }

    @Override
    public String getRemark() {
        return "使用用户名密码登录能够正确返回token";
    }

    @PostMapping("/testcase")
    @Override
    public BaseResponseDto testcase(@RequestBody BaseTestReqDto baseDto) {
        return loginCaseService.testcase(baseDto);
    }


}
